package chapter5_polymorphic_PracticeOnTheMachine;

public class Ship extends Common{
	private float Ship1;
	private float Ship2;
	private float Ship3;
	private float Length;
	
	public Ship(float ship1, float ship2, float ship3) {
		this.Ship1 = ship1;
		this.Ship2 = ship2;
		this.Ship3 = ship3;
	}
	
	public Ship(float ship1, float ship2, float ship3,float length) {
		this.Ship1 = ship1;
		this.Ship2 = ship2;
		this.Ship3 = ship3;
		this.Length = length;
	}
	
	public float speed() {
		float velocity = (this.Ship1 + this.Ship2) / this.Ship3;
		return velocity;
	}
	
	public float time() {
		float time = Length * 1000 / ((this.Ship1 + this.Ship2) / this.Ship3);
		return time;
		
	}
}
